package com.asm.DBloader;

import android.content.ContentValues;
import android.content.Context;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;

public class ASM_FinvDetDS {
	private SQLiteDatabase dB;
	private ASM_DB dbHelper;
	Context context;
	
	
	public ASM_FinvDetDS(Context context) {
		this.context = context;
		dbHelper  = new ASM_DB(context);
		
	}
	
	public void open() throws SQLException
	{
		dB = dbHelper.getWritableDatabase();
	}
	public int Create(ASM_FinvDet det) {
		
		int count =0;
		
		if(dB == null){
			open();
		}else if(!dB.isOpen()){
			open();
		}
		
		 
	
		ContentValues values = new ContentValues();
		values.put(ASM_DB.asmInvDet_RefNo, det.getAsmInvDet_RefNo());
		values.put(ASM_DB.asmInvDet_TxnDate, det.getAsmInvDet_TxnDate() );
		values.put(ASM_DB.asmInvDet_TxnType, det.getAsmInvDet_TxnType());
		values.put(ASM_DB.asmInvDet_Itemcode, det.getAsmInvDet_Itemcode());
		values.put(ASM_DB.asmInvDet_Type, det.getAsmInvDet_Type());
		values.put(ASM_DB.asmInvDet_BAmt, det.getAsmInvDet_BAmt());
		values.put(ASM_DB.asmInvDet_FrIss,det.getAsmInvDet_FrIss());

		
		count = (int) dB.insert(ASM_DB.ASM_FINVDET, null, values);

		dB.close();
		return count;
		
	}
}
